<?php

namespace  bc\model;

use bc\ar\MActiveRecord;
use bc\ar\ItemModel;

class ItemdataModel extends \bc\ar\MActiveRecord{
    /**
     * bc_item_data表
     */
     public static function tableName()
   {
		return '{{%item_data}}'; 
   }
//   
//     public function datatractionInsert($item_data_id,$values,$newsubitemkey)
//    {
//    	$transaction = $this->getDb()->beginTransaction();
//    	try 
//    	{
//	   
//	        $sql = 'INSERT ' . self::getTableSchema ()->name . "(item_data_id, subitem_id, subitem_value , deleted) VALUES ( {$item_data_id}, '{$value}',1,0)";
//	        $this->getDb()->createCommand($sql)->execute();
//         
//    		$transaction->commit();
//    	}
//		catch (\Exception $e) 
//    	{
//			$transaction->rollBack();
//			throw $e;
//    	}
//    }

    public function insertByArr()
    {

    }
    
    public function insertByBindId($bind_id)
    {    
        $this->columns = 'id';
        $params = array(
            "bc_item_data.bind_id" =>  $bind_id,
        );
        $ar = $this->find ()->select($this->columns) ->where($params);
        return $ar->asArray()->all();
    
        
    }
   
}

